<%@ Page Title="Edit Item" Language="C#" MasterPageFile="~/Pages/user/userMaster.Master" AutoEventWireup="true" CodeBehind="EditItem.aspx.cs" Inherits="WarehouseWebAPP.Pages.user.Edit_Entities.EditItem" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">
    .style13
    {
        height: 45px;
    }
        .style16
        {
            width: 74px;
            height: 14px;
        }
        .style20
        {
            width: 183px;
        }
        .style33
        {
            color: #6D6D6D;
            text-align: left;
        }
        .style35
        {
            color: #000000;
        }
        </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <table class="style1" style="width: 102%">
    <tr>
        <td align="center">
                <asp:UpdatePanel ID="UpdatePanel2" runat="server">
                    <ContentTemplate>
                        <asp:Label ID="SentLabel" runat="server" BackColor="#FFFFCC" 
                    ForeColor="#607894" Text="Mail Sent" Visible="False"></asp:Label>
                    </ContentTemplate>
                </asp:UpdatePanel>
        </td>
    </tr>
    <tr>
        <td align="center">
                <asp:UpdateProgress ID="UpdateProgress3" runat="server" DisplayAfter="1000">
                    <ProgressTemplate>
                        <img alt="" src="../../images/update.gif" style="width: 31px; height: 31px" />
                    </ProgressTemplate>
                </asp:UpdateProgress>
        </td>
    </tr>
    <tr>
        <td valign=top>
            <asp:Panel ID="Panel1" runat="server" Height="31px" style="position: relative">
                <asp:Label ID="Label2" runat="server" Font-Bold="True" Font-Italic="False" 
                    Font-Overline="False" Font-Underline="True" Text="Item Serial:" 
                ForeColor="#5D7B9D"></asp:Label>
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <cc1:ComboBox ID="ComboBox1" runat="server" AppendDataBoundItems="True" 
                    AutoCompleteMode="Append" DataSourceID="Item2ObjectDataSource" 
                    DataTextField="lend_item_serial" DataValueField="lend_item_serial" 
                    DropDownStyle="DropDownList" MaxLength="0" style="display: inline;">
                </cc1:ComboBox>
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <asp:Button ID="Button1" runat="server" BackColor="#FFFBFF" 
                    BorderColor="#CCCCCC" BorderStyle="Solid" BorderWidth="1px" 
                    Font-Names="Verdana" Font-Size="Small" ForeColor="#284775" 
                    onclick="Button1_Click" Text="GO" Width="76px" />
            </asp:Panel>
        </td>
    </tr>
    <tr>
        <td valign="top">
                            <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
                                <ContentTemplate>                                
                                    <asp:Label ID="ErrorLabel" runat="server" BackColor="#FFFFCC" 
                                ForeColor="Maroon" Height="24px" 
                                Text="Error: The entity can't be deleted from the following reason: This entity is a FK of other entity." 
                                Visible="False"></asp:Label>
                                    <asp:DetailsView ID="ItemDetailsView" runat="server" AllowPaging="True" 
                                        AutoGenerateRows="False" CellPadding="4" DataKeyNames="lend_item_num" 
                                        DataSourceID="ItemObjectDataSource" ForeColor="#333333" GridLines="None" 
                                        Height="50px" ondatabound="ItemDetailsView_DataBound" 
                                        onitemcommand="ItemDetailsView_ItemCommand" 
                                        onitemdeleting="ItemDetailsView_ItemDeleting" Width="499px">
                                        <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                        <CommandRowStyle BackColor="#E2DED6" Font-Bold="True" />
                                        <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                                        <FieldHeaderStyle BackColor="#E9ECF1" Font-Bold="True" />
                                        <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                                        <Fields>
                                            <asp:BoundField DataField="lend_item_num" HeaderText="lend_item_num" 
                                                ReadOnly="True" SortExpression="lend_item_num" Visible="False" />
                                            <asp:TemplateField HeaderText="Item Serial Number" 
                                                SortExpression="lend_item_serial">
                                                <EditItemTemplate>
                                                    <asp:TextBox ID="SNTextBox" runat="server" 
                                                        Text='<%# Bind("lend_item_serial") %>'></asp:TextBox>
                                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                                                        ControlToValidate="SNTextBox" ErrorMessage="*"></asp:RequiredFieldValidator>
                                                    <asp:CustomValidator ID="CustomValidator1" runat="server" 
                                                        ControlToValidate="SNTextBox" ErrorMessage="Already Exist" 
                                                        onservervalidate="CustomValidator1_ServerValidate"></asp:CustomValidator>
                                                </EditItemTemplate>
                                                <InsertItemTemplate>
                                                    <asp:TextBox ID="TextBox3" runat="server" 
                                                        Text='<%# Bind("lend_item_serial") %>'></asp:TextBox>
                                                </InsertItemTemplate>
                                                <ItemTemplate>
                                                    <asp:Label ID="ItemLabel" runat="server" Text='<%# Bind("lend_item_serial") %>'></asp:Label>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:CheckBoxField DataField="lend_item_available" HeaderText="Available" 
                                                SortExpression="lend_item_available" />
                                            <asp:BoundField DataField="lend_item_description" HeaderText="Description" 
                                                SortExpression="lend_item_description" />
                                            <asp:BoundField DataField="lend_item_place" HeaderText="Location" 
                                                SortExpression="lend_item_place" />
                                            <asp:TemplateField HeaderText="Supplier" SortExpression="lend_item_supplier">
                                                <EditItemTemplate>
                                                    <cc1:ComboBox ID="ComboBox2" runat="server" AppendDataBoundItems="True" 
                                                        AutoCompleteMode="Append" DataSourceID="SupplierObjectDataSource" 
                                                        DataTextField="supplier_name" DataValueField="supplier_num" 
                                                        DropDownStyle="DropDownList" MaxLength="0" 
                                                        SelectedValue='<%# Bind("lend_item_supplier") %>' style="display: inline;">
                                                    </cc1:ComboBox>
                                                    <asp:ObjectDataSource ID="SupplierObjectDataSource" runat="server" 
                                                        SelectMethod="SupplierGet" TypeName="WarehouseWebAPP.code.BLL.SupplierBLL">
                                                    </asp:ObjectDataSource>
                                                </EditItemTemplate>
                                                <InsertItemTemplate>
                                                    <asp:TextBox ID="TextBox1" runat="server" 
                                                        Text='<%# Bind("lend_item_supplier") %>'></asp:TextBox>
                                                </InsertItemTemplate>
                                                <ItemTemplate>
                                                    <asp:Label ID="SupplierLabel" runat="server" 
                                                        Text='<%# Bind("lend_item_supplier") %>'></asp:Label>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Vendor" SortExpression="lend_item_vendor">
                                                <EditItemTemplate>
                                                    <cc1:ComboBox ID="ComboBox3" runat="server" AppendDataBoundItems="True" 
                                                        AutoCompleteMode="Append" DataSourceID="VendorObjectDataSource" 
                                                        DataTextField="vendor_name" DataValueField="vendor_num" 
                                                        DropDownStyle="DropDownList" MaxLength="0" 
                                                        SelectedValue='<%# Bind("lend_item_vendor") %>' style="display: inline;">
                                                    </cc1:ComboBox>
                                                    <asp:ObjectDataSource ID="VendorObjectDataSource" runat="server" 
                                                        SelectMethod="VendorGet" TypeName="WarehouseWebAPP.code.BLL.VendorBLL">
                                                    </asp:ObjectDataSource>
                                                </EditItemTemplate>
                                                <InsertItemTemplate>
                                                    <asp:TextBox ID="TextBox2" runat="server" 
                                                        Text='<%# Bind("lend_item_vendor") %>'></asp:TextBox>
                                                </InsertItemTemplate>
                                                <ItemTemplate>
                                                    <asp:Label ID="VendorLabel" runat="server" 
                                                        Text='<%# Bind("lend_item_vendor") %>'></asp:Label>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
                                            <asp:ButtonField CommandName="MailItem" Text="Mail Item" />
                                        </Fields>
                                        <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                        <EditRowStyle BackColor="#999999" />
                                        <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                                    </asp:DetailsView>
                                    <br />
                                    <asp:Panel ID="MailPanel1" runat="server" BorderStyle="Groove" 
                                        CssClass="style33" Height="324px" Visible="False">
                                        <br />
                                        <asp:RadioButton ID="SupplierRadioButton" runat="server" Checked="True" 
                                            GroupName="Group1" Text="Send This Component to it's Supplier" 
                                            ForeColor="Black" />
                                        <br />
                                        <asp:RadioButton ID="CustomerRadioButton" runat="server" GroupName="Group1" 
                                            Text="Send This Component to the following Customer " ForeColor="Black" />
                                        &nbsp;<span class="style35"><cc1:ComboBox ID="CustomerComboBox" runat="server" 
                                            AppendDataBoundItems="True" AutoCompleteMode="Append" 
                                            DataSourceID="CustomerObjectDataSource" DataTextField="customer_name" 
                                            DataValueField="customer_num" DropDownStyle="DropDownList" MaxLength="0" 
                                            style="display: inline;">
                                        </cc1:ComboBox>
                                        <br />
                                        <br />
                                        Add Notes:</span><br />
                                        <asp:TextBox ID="NotesTextBox" runat="server" Height="146px" 
                                            TextMode="MultiLine" Width="615px" ForeColor="Black"></asp:TextBox>
                                        <br />
                                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                        <asp:Button ID="SendButton" runat="server" BackColor="#FFFBFF" 
                                            BorderColor="#CCCCCC" BorderStyle="Solid" BorderWidth="1px" 
                                            Font-Names="Verdana" Font-Size="Small" ForeColor="#284775" Height="25px" 
                                            onclick="SendButton_Click" style="text-align: center" Text="Send Mail" 
                                            Width="99px" />
                                        <br />
                                    </asp:Panel>
                                </ContentTemplate>
                                <Triggers>
                                    <asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" />
                                </Triggers>
                            </asp:UpdatePanel>
            </td>
    </tr>
        <tr>
        <td >
            <asp:ObjectDataSource ID="ItemObjectDataSource" runat="server" SelectMethod="LendItemBySerial" 
                TypeName="WarehouseWebAPP.code.BLL.LendItemBLL" 
                UpdateMethod="LendItemUpdate" DeleteMethod="LendItemDelete">
                <UpdateParameters>
                    <asp:Parameter Name="lend_item_serial" Type="String" />
                    <asp:Parameter DbType="Guid" Name="lend_item_vendor" />
                    <asp:Parameter Name="lend_item_description" Type="String" />
                    <asp:Parameter Name="lend_item_place" Type="String" />
                    <asp:Parameter DbType="Guid" Name="lend_item_supplier" />
                    <asp:Parameter Name="lend_item_available" Type="Boolean" />
                    <asp:Parameter DbType="Guid" Name="lend_item_num" />
                </UpdateParameters>
                <SelectParameters>
                    <asp:ControlParameter ControlID="ComboBox1" DefaultValue="%" 
                        Name="lend_item_serial" PropertyName="SelectedValue" Type="String" />
                </SelectParameters>
            </asp:ObjectDataSource>
            <asp:ObjectDataSource ID="CustomerObjectDataSource" runat="server" 
                SelectMethod="CustomerGet" TypeName="WarehouseWebAPP.code.BLL.CustomerBLL">
            </asp:ObjectDataSource>
            <asp:ObjectDataSource ID="Item2ObjectDataSource" runat="server" 
                SelectMethod="lendItemGet" TypeName="WarehouseWebAPP.code.BLL.LendItemBLL" 
                OldValuesParameterFormatString="original_{0}">
            </asp:ObjectDataSource>
            </td>
        </tr>
    <tr>
        <td colspan="3" valign="top">
            &nbsp;</td>
    </tr>
</table>
</asp:Content>
